package com.Ajava1704.for设计模式.for原型模式;

import java.io.IOException;

/**
 * @类名: com.Ajava1704.for设计模式.for原型模式
 * @作者: lgt
 * @创建时间: 2020-02-15 14:45
 * @描述:
 **/
public class ForTest004 {
    public static void main(String[] args) throws CloneNotSupportedException, IOException, ClassNotFoundException {
        ForYuanXing forYuanXing = new ForYuanXing();
        forYuanXing.setUsername("666666");
        //浅克隆的调用
        ForYuanXing clone = forYuanXing.clone();
        System.out.println(clone.getUsername());
        System.out.println(clone.getUsername()==forYuanXing.getUsername());

        System.out.println("============================================");

        //深克隆的调用
        ForYuanXing deepClone = forYuanXing.deepClone();
        System.out.println(deepClone.getUsername());
        System.out.println(forYuanXing.getUsername()==deepClone.getUsername());


    }
}
